import request from "../utils/request"

export const loginApi = (body)=>request("/login",{
    method:"post",
    body
})
export const getMenuApi = ()=>request("/menu/mrbird",{
    method:"get"
})
export const getStatisticDataApi = (username)=>request("/index/"+username);

export const userApi = () => {
    return request('/user',{
        method:'get',
    })
}

export const profileApi = (body) => request('/user/profile',{
    method:'put',
    body
})
// 根据用户名获取权限菜单
export const menuApi = (username) => {
    return request(`/menu/${username}`,{
        method:'get',
    })
}

// 获取用户数据
export const getUserApi = (query) => {
    return request(`/user`,{
        method:'get',
        query
    })
}
// 修改用户数据
export const alterUserApi = (query) => {
    return request('/user',{
        method:'put',
        query
    })
}

// 新增用户
export const addUserApi = (body) => {
    return request('/user',{
        method:'post',
        body
    })
}

// 根据用户 ID 删除用户
export const delUserApi = (userId) => {
    return request(`/user/${userId}`,{
        method:'delete'
    })
}

// 获取角色数据
export const roleApi = () => {
    return request('/role',{
        method:'get',
    })
}

//获取部门信息
export const getDeptApi = () => {
    return request('/dept',{
        method:'get',
    })
}

//修改用户头像
export const changeUserImgApi = (body) => request('/user/avatar', {
    method: "put",
    body
})

//获取所有用户数据
export const getAllUserInfoApi = (query) => request("/user", {
    method: "get",
    query
})
//修改用户信息
export const updateUserInfoApi = (body) => request('/user', {
    method: "put",
    body
})
